<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="father">
  <h1>h1</h1>
  <p id="p1">p1</p>
  <p class="p2">p2</p>
</div>
<script>
  'use strict';
  // 先获取自己。。
  var p1 = document.getElementById("p1");
  // 获取父节点
  var father = p1.parentElement;

  father.removeChild(p1); // 通过父亲删除自己
</script>
</body>
</html>